import { requestClient } from '#/api/request';

export namespace CmtMerchantApplyApi {
  /** 商户入驻申请 */
  export interface MerchantApply {
    id?: number;
    communityId?: number;
    userId?: number;
    name: string;
    merchantType?: number;
    businessLicense?: string;
    licenseNo?: string;
    legalPerson?: string;
    contactPerson?: string;
    contactPhone?: string;
    address?: string;
    introduction?: string;
    serviceScope?: string;
    auditStatus?: number;
    auditUserId?: number;
    auditTime?: string;
    auditRemark?: string;
    merchantId?: number;
    status?: number;
    remark?: string;
    createTime?: string;
  }

  /** 商户入驻申请分页查询参数 */
  export interface MerchantApplyPageReqVO {
    pageNo: number;
    pageSize: number;
    name?: string;
    communityId?: number;
    userId?: number;
    merchantType?: number;
    auditStatus?: number;
    status?: number;
    createTime?: string[];
  }
}

/** 查询商户入驻申请分页 */
export function getMerchantApplyPage(params: CmtMerchantApplyApi.MerchantApplyPageReqVO) {
  return requestClient.get<any>('/cmt/base-merchant-apply/page', { params });
}

/** 查询商户入驻申请详情 */
export function getMerchantApply(id: number) {
  return requestClient.get<CmtMerchantApplyApi.MerchantApply>('/cmt/base-merchant-apply/get', {
    params: { id },
  });
}

/** 新增商户入驻申请 */
export function createMerchantApply(data: CmtMerchantApplyApi.MerchantApply) {
  return requestClient.post<number>('/cmt/base-merchant-apply/create', data);
}

/** 修改商户入驻申请 */
export function updateMerchantApply(data: CmtMerchantApplyApi.MerchantApply) {
  return requestClient.put<boolean>('/cmt/base-merchant-apply/update', data);
}

/** 删除商户入驻申请 */
export function deleteMerchantApply(id: number) {
  return requestClient.delete<boolean>('/cmt/base-merchant-apply/delete?id=' + id);
}

/** 批量删除商户入驻申请 */
export function deleteMerchantApplyList(ids: number[]) {
  return requestClient.delete<boolean>(
    '/cmt/base-merchant-apply/delete-list?ids=' + ids.join(','),
  );
}

/** 导出商户入驻申请 Excel */
export function exportMerchantApply(params: CmtMerchantApplyApi.MerchantApplyPageReqVO) {
  return requestClient.get<Blob>('/cmt/base-merchant-apply/export-excel', {
    params,
    responseType: 'blob',
  });
}
